<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 创建一个空 map
    let map = new Map()


    // 属性和方法
    // size   set   get   has   delete   clear

    map.set('name', '张三')
    map.set('func', function () {
      console.log('我是一个函数');
    })
    map.set('obj', { a: 'aaa', b: 'bbb' })
    console.log(map);

    console.log(map.size);  // 3

    console.log(map.get('name'));   // 张三

    map.delete('name')
    console.log(map);

    map.forEach(item => {
      console.log(item);
    })

    map.clear()
    console.log(map);   // Map(0) {size: 0}


  </script>
</body>

</html>